package com.sqgxy;

import com.sqgxy.service.UserService;
import org.springframework.boot.ConfigurableBootstrapContext;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class SpringbootContainerApplication {

    public static void main(String[] args) {
        //一般用来测试service能不能使用
        //获取容器对象
        //ConfigurableApplicationContext ctx= SpringApplication.run(SpringbootContainerApplication.class, args);
        ApplicationContext ctx= SpringApplication.run(SpringbootContainerApplication.class, args);

        //从容器中获取对象
        UserService userService= (UserService) ctx.getBean("userService");

        userService.sayHello("刘东帅");
    }

}
